package com.xinchuang.controller.targetSystem.damage;

import com.xinchuang.comment.R;
import com.xinchuang.common.Result;
import com.xinchuang.dto.DeleteDto;
import com.xinchuang.entity.targetSystem.damage.AvoidHitting;
import com.xinchuang.service.targetSystem.damage.IAvoidHittingService;
import com.xinchuang.vo.AvoidHittingVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: BD区域
 * @Author: zhb
 */
@RestController
@RequestMapping("/avoidHitting")
@RequiredArgsConstructor
@Api(value = "BD区域管理", tags = "BD区域管理")
public class BDAreaController {

    private final IAvoidHittingService iAvoidHittingService;

    /**
     * 获取HS计算标准列表接口
     *
     * @param pageNum
     * @param pageSize
     * @param avoidHittingName 避打区域名称 required = false
     * @param avoidHittingType 避打类型 required = false
     * @return
     */
    @GetMapping("/getList")
    @ApiOperation("获取BD区域列表接口")
    public R getList(@RequestParam(value = "pageNum") int pageNum,
                     @RequestParam(value = "pageSize") int pageSize,
                     @RequestParam(value = "avoidHittingName", required = false) String avoidHittingName,
                     @RequestParam(value = "avoidHittingType", required = false) String avoidHittingType) {
        return iAvoidHittingService.selectEntities(pageNum, pageSize, avoidHittingName, avoidHittingType);
    }

    /**
     * 增加或修改HS计算标准接口
     *
     * @param form
     * @return
     */
    @PostMapping("/addOrUpdateEntity")
    @ApiOperation("增加或修改BD区域接口")
    public Result addOrUpdateEntity(@RequestBody AvoidHittingVo form) {
        return iAvoidHittingService.addOrUpdateEntity(form);
    }

    /**
     * 删除HS计算标准接口
     * @return
     */
    @PostMapping("/delEntity")
    @ApiOperation("删除BD区域接口")
    public R delEntity(@RequestBody DeleteDto deleteDto) {
        return iAvoidHittingService.deltEntities(deleteDto.getIds(), deleteDto.getDeleteStatus());
    }
}
